package com.drei.wolke.controller; 
/** 
* @author 作者 owen E-mail: 624191343@qq.com
* @version 创建时间：2017年11月13日 上午10:55:27 
* 类说明 
*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.drei.wolke.service.ScheduleJobService;


@RestController
public class ScheduleController {

    Logger logger = LoggerFactory.getLogger(ScheduleController.class);
    
    @Autowired
	private ScheduleJobService scheduleJobService;

    @GetMapping("/schedule/resume/{id}")
    public String resume(@PathVariable(name = "id") Long id) {

    	scheduleJobService.resume(new Long[]{id}) ;
    	return "succuss" ;
    }
    
    @GetMapping("/schedule/pause/{id}")
    public String pause(@PathVariable(name = "id") Long id) {

    	scheduleJobService.pause(new Long[]{id}) ;
    	return "succuss" ;
    }

	@RequestMapping("/schedule/run")
	public String run(@RequestBody Long[] jobIds){
		scheduleJobService.run(jobIds);
		
		   return "succuss" ;
	}
	@RequestMapping("/schedule/delete")
	public String delete(@RequestBody Long[] jobIds){
		scheduleJobService.deleteBatch(jobIds);
		
		 return "succuss" ;
	}
    
}
